@@ -1,6 +1,9 @@ |
||
1 | 1 |
class JSONWithIndifferentAccess |
2 | 2 |
def self.load(json) |
3 | 3 |
ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(json || '{}')) |
4 |
+ rescue JSON::ParserError |
|
5 |
+ Rails.logger.error "Unparsable JSON in JSONWithIndifferentAccess: #{json}" |
|
6 |
+ { 'error' => 'unparsable json detected during de-serialization' } |
|
4 | 7 |
end |
5 | 8 |
|
6 | 9 |
def self.dump(hash) |